home *** CD-ROM | disk | FTP | other *** search
/ NeXT Education Software Sampler 1992 Fall / NeXT Education Software Sampler 1992 Fall.iso / Programming / Source / PacMan / Player.h < prev    next >
Encoding:
Text File  |  1992-06-29  |  1.5 KB  |  51 lines

  1.  
  2. /* Generated by Interface Builder */
  3.  
  4. // Handles moving and rendering the Pac, whether under player or demo control.
  5.  
  6.  
  7. #import "GameActor.h"
  8.  
  9.  
  10. // legal directions to use as arguments to -newDirection: method
  11. // also, as bitmasks for various arrays.
  12. #define PAC_UP        0x08
  13. #define PAC_DOWN    0x04
  14. #define PAC_LEFT    0x02
  15. #define PAC_RIGHT    0x01
  16. #define PAC_STOP    0    // default; if not one of the above, we assume stopped
  17.  
  18. #define PAC_WIDTH    16    // width of a pac image in pixels (square)
  19.  
  20. // legal states the Pac can be in
  21. #define PAC_DEAD    0
  22. #define PAC_ALIVE    1
  23. #define PAC_DYING    -11    // ten steps in death animation, then fully dead
  24.  
  25.  
  26. @interface Player:GameActor
  27. {
  28.     id  maze;            // Maze
  29.     id  pacsLeft;        // PlayerUpView
  30.     id  pacs;            // pac images
  31.     
  32.     int    curDir;            // which way the player wants to go
  33.     int    nextDir;        // which way the player wants to go next
  34.     int pacX, pacY;        // where we're at
  35.     int state;            // alive, dead, etc.
  36.     int cycle;            // frame counter for animation
  37. }
  38.  
  39. - init;                        // initialize the player
  40. - (BOOL)newPlayer;            // get and set up a new Pac.  Returns NO if can't
  41. - resetPlayer;                // reset all player info
  42. - (BOOL)pacAlive;            // returns YES if Pac is alive
  43. - pacDie;                    // the pac will melt
  44. - move:sender;                // Move the PacMan one animation frame
  45. - demoMove:sender;            // Move the PacMan one animation frame (demo cntl)
  46. - newDirection:(int)newDir;    // send Pac in new direction.
  47. - renderAt:(int)posx :(int)posy move:(BOOL)moveOk;    // draw pac
  48.         // you should lock focus on view that gets the Pac first.
  49.  
  50. @end
  51.